<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模拟ChatGPT</title>
</head>
<body>
<h1>模拟ChatGPT</h1>
<button onclick="send()">发送</button>
<div id="stock-price"></div>

<script>
    function send() {
        const eventSource = new EventSource('http://localhost:8001/chat');
        eventSource.addEventListener('message', (event) => {
            const data = event.data;
            document.getElementById('stock-price').innerHTML = event.data;
            console.log('Received message:', data);
        });
    }
</script>
</body>
</html>